<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <ul>
    <li>腰子</li>
    <li>生蚝</li>
    <li>板筋</li>
    <li>脑花</li>
    <li>花毛一体</li>
    <li>火山盖顶</li>
  </ul>
  <!-- 写一个函数 将 aa-bb-cc-dd   转化成驼峰     aaBbCcDd  -->
  <script>
    var str = "aadfaf-bb-cc-dd";
    var arr = str.split("-");
    console.log(arr); //["aadfaf","bb","cc","dd"]
    // 
    var newarr = arr.map(function (ele, index) {
      if (index == 0) {
        return ele
      } else {
        return ele.charAt(0).toUpperCase() + ele.substr(1)
      }
    })
    console.log(newarr)
    console.log(newarr.join(""))
    //  js 完成隔行变色
    var lis = document.getElementsByTagName("li");
    for (var i = 0; i < lis.length; i++) {
      if (i % 2 == 0) {
        lis[i].style.backgroundColor = "red"
      } else {
        lis[i].style.backgroundColor = "blue";
      }
    }

  </script>
</body>

</html>